package com.sunny.demo1;

import java.lang.reflect.Proxy;

public class DynamicDemo {

    private Caculator proxy;

    public DynamicDemo(Caculator caculator) {
        this.proxy = (Caculator) Proxy.newProxyInstance(caculator.getClass().getClassLoader(),
                caculator.getClass().getInterfaces(),
                new CaculateHandler(caculator));
    }

    public Caculator getProxy() {
        return this.proxy;
    }

}

